#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

char* my_strncpy(char* s1, const char* s2, size_t num)
{
	while (num--)
	{
		*s1++ = *s2++;
		if (*s2 == 0)
			*s1++ = 0;
	}
	return s1;
}
int main()
{
	char s1[10] = "abcdefg";
	char s2[10] = "aaaaa";
	my_strncpy(s1, s2, 3);
	printf("%s\n", s1);
	return 0;
}